<div class="page-header">
    <h4>壁纸标签 -
        <small>找到 <?php echo $total_count; ?>个标签</small>
    </h4>
</div>

<?php if ($tags) { ?>
    <table class="table table-striped tr-sm">
        <thead>
        <tr>
            <th>#</th>
            <th>标签</th>
            <th>壁纸数量</th>
            <th>比例</th>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($tags as $k => $tag) { ?>
            <?php $k++; ?>
            <tr>
                <td><?php echo $offset + $k; ?></td>
                <td><a href="<?php echo base_url(); ?>search?q=<?php echo $tag->tag_name; ?>"><?php echo $tag->tag_name; ?></a></td>
                <td><?php echo $tag->count; ?></td>
                <td>
                    <?php $percentage = ($tag->count / $top_count) * 100; ?>
                    <?php
                    if ($percentage >= 75)
                        $status = 'success';
                    elseif ($percentage >= 45)
                        $status = 'warning';
                    else $status = 'danger';
                    ?>
                    <div class="progress progress-sm tag">
                        <div class="progress-bar progress-bar-<?= $status; ?>" role="progressbar" aria-valuenow="<?= $percentage; ?>"
                             aria-valuemin="0" aria-valuemax="100" style="width:<?= $percentage; ?>%">
                        </div>
                    </div>
                </td>
            </tr>
        <?php } ?>
        </tbody>
    </table>
<?php } ?>

<?php echo $pagination; ?>